<template>
  <div>
    <el-breadcrumb separator-class="el-icon-arrow-right">
      <el-breadcrumb-item :to="{ path: '/home' }">首页</el-breadcrumb-item>
      <el-breadcrumb-item>系统工具</el-breadcrumb-item>
      <el-breadcrumb-item>quill编辑器</el-breadcrumb-item>
    </el-breadcrumb>
    <div class="edit_container">
      <quill-editor
              :options="editorOption"
              @blur="onEditorBlur($event)"
              @change="onEditorChange($event)"
              @focus="onEditorFocus($event)"
              ref="myQuillEditor"
              v-model="content"
      ></quill-editor>
      <el-button type="primary" @click="saveHtml">保存</el-button>
    </div>
  </div>
</template>

<script>
export default {
  name: 'App',
  data() {
    return {
      content: ``,
      editorOption: {
        theme: 'snow',
        placeholder: '请输入正文'
      },
    }
  },
  computed: {
    editor() {
      return this.$refs.myQuillEditor.quill
    }
  },
  methods: {
    onEditorBlur() {}, // 失去焦点事件
    onEditorFocus() {}, // 获得焦点事件
    onEditorChange() {}, // 内容改变事件
    saveHtml() {
      console.log(this.content);
    },
  }
}
</script>
<style lang="less" scope>
  .edit_container {
    font-family: 'Avenir', Helvetica, Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    color: #2c3e50;
    margin-top: 30px;
  }
  .ql-editor{
    min-height:400px;
  }
</style>